package Control;

import Model.User;
import View.SecondMenu;
import View.ThirdMenu;

import java.io.File;
import java.io.IOException;

import static Control.main.s;

//用于登录后功能的核心控制
public class funtion {
    //修改信息功能
    public static void change(User u) throws IOException {
        ThirdMenu.changePrint();
        switch(SecondMenu.Option()) {
            case 1:
                System.out.println("（1）修改密码");
                System.out.println("密码修改为:");
                u.setCode(s.next());
                File file1 = fileProcess.fileCreate();
                fileProcess.fileWrite(file1);
                print();
                over();
                break;
            case 2:
                System.out.println("（2）修改身份证号码");
                System.out.println("身份证号码修改为:");
                u.setIdNumber(s.next());
                File file2 = fileProcess.fileCreate();
                fileProcess.fileWrite(file2);
                print();
                over();
                break;
            case 3:
                System.out.println("（3）修改联系方式");
                System.out.println("联系方式修改为:");
                u.setPhoneNumber(s.next());
                File file3 = fileProcess.fileCreate();
                fileProcess.fileWrite(file3);
                print();
                over();
                break;
            default:
                System.out.println("输入错误！");
                over();
        }
    }
    private static void print() {
        System.out.println("修改成功");
    }
    private static void over() {
        System.exit(0);
    }















}
